home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / IShield for Visual C++ 6.0 / DATA1.CAB / Include_Files / SDCNEWD.RUL < prev    next >
Encoding:
Text File  |  1997-11-20  |  4.6 KB  |  122 lines

  1.  
  2.  /*=======================================================================*/
  3.  /*                                                                       */
  4.  /*           (c) InstallShield Software Corporation (1996-1997)          */
  5.  /*            (c)  InstallShield Corporation  (1990-1996)                */
  6.  /*                       Schaumburg, Illinois 60173                      */
  7.  /*                          All Rights Reserved                          */
  8.  /*                           InstallShield (R)                           */
  9.  /*                                                                       */
  10.  /*   File    : sdcnewd.rul                                               */
  11.  /*                                                                       */
  12.  /*   Purpose : This file contains the code for the SdConfirmNewDir       */
  13.  /*             script dialog function.                                   */
  14.  /*                                                                       */
  15.  /*=======================================================================*/
  16.  
  17.  /*------------------------------------------------------------------------*/
  18.  /*                                                                        */
  19.  /*   Function: SdConfirmNewDir                                            */
  20.  /*                                                                        */
  21.  /*   Descrip:  This dialog will confirm the creation of a new directory   */
  22.  /*                                                                        */
  23.  /*   Misc:                                                                */
  24.  /*                                                                        */
  25.  /*------------------------------------------------------------------------*/
  26. function SdConfirmNewDir(szTitle, szDir, nStyle)
  27.           STRING  szDlg, szTemp;
  28.           NUMBER  nId, nTemp;
  29.           HWND    hwndDlg;
  30.           BOOL    bDone;
  31.         begin
  32.  
  33.            szDlg     = SD_DLG_CONFIRMNEWDIR;
  34.            nSdDialog = SD_NDLG_CONFIRMNEWDIR;
  35.  
  36.            // record data produced by this dialog
  37.            if (MODE=SILENTMODE) then
  38.              SdMakeName( szAppKey, szDlg, szTitle, nSdConfirmNewDir );
  39.              SilentReadData( szAppKey, "Result", DATA_NUMBER, szTemp, nId );
  40.              if ( CreateDir( szDir ) < 0 ) then
  41.                       nId   = -1;
  42.          endif;        
  43.              return nId;
  44.            endif;
  45.  
  46.            // ensure general initialization is complete
  47.            if (!bSdInit) then
  48.               SdInit();
  49.            endif;
  50.  
  51.            if (EzDefineDialog( szDlg, "", "", SD_NDLG_CONFIRMNEWDIR ) = DLG_ERR) then
  52.                return -1;
  53.            endif;
  54.  
  55.  
  56.            // Loop in dialog until the user selects a standard button
  57.            bDone = FALSE;
  58.  
  59.            while (!bDone)
  60.  
  61.               nId = WaitOnDialog( szDlg );
  62.  
  63.               switch (nId)
  64.               case DLG_INIT:
  65.                    hwndDlg = CmdGetHwndDlg( szDlg );
  66.                    SdGeneralInit( szDlg, hwndDlg, nStyle, szSdProduct );
  67.  
  68.                    if(szTitle != "") then
  69.                        SetWindowText(hwndDlg, szTitle);
  70.                    endif;
  71.  
  72.                    if(szDir != "") then
  73.                       CtrlSetText(szDlg, SD_STA_NEWDIR, szDir);
  74.                    endif;
  75.  
  76.               case SD_PBUT_YES:
  77.                    bDone = TRUE;
  78.                    nId   = YES;
  79.                    if ( CreateDir( szDir ) < 0 ) then
  80.                       nId   = -1;
  81.                       bDone = TRUE;
  82.                    endif;
  83.  
  84.               case SD_PBUT_NO:
  85.                    nId   = NO;
  86.                    bDone = TRUE;
  87.  
  88.               case BACK:
  89.                    nId    = BACK;
  90.                    bDone  = TRUE;
  91.  
  92.               case DLG_ERR:
  93.                    SdError( -1, "SdConfirmNewDir" );
  94.                    nId   = -1;
  95.                    bDone = TRUE;
  96.  
  97.               case DLG_CLOSE:
  98.                    SdCloseDlg( hwndDlg, nId, bDone );
  99.  
  100.               default:
  101.                    // check standard handling
  102.                    if (SdIsStdButton( nId ) && SdDoStdButton( nId )) then
  103.                       bDone = TRUE;
  104.                    endif;
  105.  
  106.               endswitch;
  107.  
  108.            endwhile;
  109.  
  110.            EndDialog( szDlg );
  111.            ReleaseDialog( szDlg );
  112.  
  113.            SdUnInit( );
  114.  
  115.            // record data produced by this dialog
  116.            SdMakeName( szAppKey, szDlg, szTitle, nSdConfirmNewDir );
  117.            SilentWriteData( szAppKey, "Result", DATA_NUMBER, "", nId );
  118.  
  119.            return nId;
  120.  
  121.         end;
  122.